namespace Brjnk.Common
{
    using System;
    using System.Windows.Data;

    /// <summary>
    /// </summary>
    public class BoolToIntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return 0;
            if ((bool)value) return 1;
            return 0;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return false;
            if (((int)value) != 0) return true;
            return false;
        }
    }
}